<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('终端购买人变更记录列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label style="width: 100px;">SN号：</label>
                                <input type="text" name="sn"/>
                            </li>
                            <li>
                                <label style="width: 100px;">变更状态：</label>
                                <select name="updateType">
                                    <option value="">所有</option>
                                    <option value="0">成功</option>
                                    <option value="1">失败</option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label style="width: 100px;">变更时间：</label>
                                <input type="text" class="time-input" id="start" placeholder="开始时间" name="start"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="end" placeholder="结束时间" name="end"/>
                            </li>
                            <li>
                                <label style="width: 100px;">失败原因：</label>
                                <select name="errorNote">
                                    <option value="">全部</option>
                                    <option value="SN号格式有误">SN号格式有误</option>
                                    <option value="SN号不存在">SN号不存在</option>
                                    <option value="已激活不允许修改">已激活不允许修改</option>
                                    <option value="SN号非划拨机具">SN号非划拨机具</option>
                                    <option value="更改失败">更改失败</option>
                                    <option value="SN号不是同一人不允许修改">SN号不是同一人不允许修改</option>
                                    <option value="活动不支持">活动不支持</option>
                                </select>
                            </li>

                            <input type="hidden" name="batch" th:value="${batch}"/>

                            <li>
                                <label style="width: 10px;"></label>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table" class="table text-nowrap"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('record:purchaserRecord:edit')}]];
        var removeFlag = [[${@permission.hasPermi('record:purchaserRecord:remove')}]];
        var prefix = ctx + "record/purchaserRecord";

        $(function() {
            var options = {
                url: prefix + "/detail",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/exportDetail",
                modalName: "终端购买人变更记录",
                firstLoad:true,
                clickToSelect:true,
                columns: [
                {
                    field: 'batch',
                    title: '批次号'
                },
                {
                    field: 'sn',
                    title: 'SN号'
                },
                {
                    field: 'model',
                    title: '终端型号'
                },
                {
                    field: 'beforePurchaser',
                    title: '原采购人编号'
                },
                {
                    field: 'beforeAgent',
                    title: '原采购人名称'
                },
                {
                    field: 'laterPurchaser',
                    title: '现采购人编号'
                },
                {
                    field: 'laterAgent',
                    title: '现采购人名称'
                },
                {
                    field: 'updateType',
                    title: '变更状态',
                    formatter: function (value, row, index){
                        if(value == '1'){
                            return '<span style="color: red">失败</span>';
                        }else{
                            return '<span style="color: green">成功</span>';
                        }
                    }
                },
                {
                    field: 'updateDate',
                    title: '变更时间'
                },
                {
                    field: 'note',
                    title: '变更备注'
                },
                {
                    field: 'errorNote',
                    title: '失败原因'
                }
                ]
            };
            $.table.init(options);
        });
    </script>
<div>
    <span>备注</span>
</div>
</body>
</html>